import json
from typing import Dict

class APIResponse:    
    @staticmethod
    def success(data: dict, status_code: int = 200) -> Dict:
        return {
            "success": True,
            "data": data,
            "error_message": "",
            "status_code": status_code
        }
    
    @staticmethod
    def error(error_message: str, status_code: int = 500) -> Dict:
        return {
            "success": False,
            "data": None,
            "error_message": error_message,
            "status_code": status_code
        }
    
    @staticmethod
    def make_response(response:dict) -> str:
        response['data'] = json.dumps(response['data'])
        return json.dumps(response)
